package com.tenentia.pcmps.swm.data.implementation;

import org.apache.log4j.Logger;

import com.tenentia.pcmps.swm.data.DataAccessException;
import com.tenentia.pcmps.swm.data.beans.Parameter;
import com.tenentia.pcmps.swm.data.interfaces.ParametersDAO;
import com.tenentia.pcmps.swm.data.util.IBatisUtilities;

/**
 * 
 * @author tEnEntia, S.L.N.E.
 * 
 */
public class ParametersDAOImpl implements ParametersDAO {

	private static final Logger LOGGER = Logger.getLogger(ParametersDAOImpl.class.getPackage().getName());
	
	@Override
	public Parameter getAvailableParameterByName(Parameter parameter) throws DataAccessException {
		try {
			parameter = (Parameter) IBatisUtilities.getSqlMapClient().queryForObject("getAvailableParameterByName", parameter.getName());
			LOGGER.debug(parameter);
		} catch (Exception e) {
			LOGGER.error(e, e);
			throw new DataAccessException(e);
		}

		return parameter;	
	}

}
